home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
dev
/
gcc
/
ixemulsrc.lha
/
ixemul-41.4
/
library
/
ixconfig.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-27
|
7KB
|
217 lines
/*
* This file is part of ixemul.library for the Amiga.
* Copyright (C) 1991, 1992 Markus M. Wild
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* NOT (!) to be used by custom applications, this is a very special case !! */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dos/datetime.h>
#include <proto/dos.h>
/* <unistd.h> must come after <proto/dos.h> because <devices/timer.h>
pulled in by <proto/dos.h> defines struct timeval as does <sys/time.h>
pulled in by <unistd.h>. However <unistd.h> has an ifdef to avoid
the collision, which <devices/timer.h> does not. */
#include <unistd.h>
#include <time.h>
#include "ixemul.h"
extern struct ixemul_base *ixemulbase;
int
main (int argc, char *argv[])
{
int c;
int do_dots = ixemulbase->ix_translate_dots;
int do_slash = ixemulbase->ix_translate_slash;
int mem_buf = ixemulbase->ix_membuf_limit;
int do_force = ixemulbase->ix_force_translation;
int do_links = ixemulbase->ix_translate_symlinks;
int do_sleep = 0;
int red_zone_size = ixemulbase->ix_red_zone_size;
int do_watch = ixemulbase->ix_watch_stack;
int fs_buf_factor = ixemulbase->ix_fs_buf_factor;
int ignore_global_env = ixemulbase->ix_ignore_global_env;
int unix_pattern_matching_case_sensitive = ixemulbase->ix_unix_pattern_matching_case_sensitive;
int no_insert_disk_requester = ixemulbase->ix_no_insert_disk_requester;
int allow_amiga_wildcard = ixemulbase->ix_allow_amiga_wildcard;
int no_flushing = ixemulbase->ix_do_not_flush_library;
while ((c = getopt (argc, argv, "./?ab:defhilm:pPr:sSuvwx")) != EOF)
switch (c)
{
case 'd':
mem_buf = 0;
/* fall into */
case 'a':
do_dots =
do_slash =
do_force =
do_links = 0;
break;
case 'b':
fs_buf_factor = atoi (optarg);
if (! fs_buf_factor)
fs_buf_factor = 64;
break;
case 'v':
no_insert_disk_requester = 1;
break;
case 'p':
unix_pattern_matching_case_sensitive = 0;
break;
case 'P':
unix_pattern_matching_case_sensitive = 1;
break;
case '.':
do_dots = 1;
break;
case '/':
do_slash = 1;
break;
case 'f':
do_force = 1;
break;
case 'i':
ignore_global_env = 1;
break;
case 'e':
ignore_global_env = 0;
break;
case 'l':
do_links = 1;
break;
case 'm':
mem_buf = atoi (optarg);
break;
case 'r':
red_zone_size = atoi (optarg);
break;
case 'S':
case 's':
do_sleep = c;
break;
case 'u':
allow_amiga_wildcard = 0;
break;
case 'w':
do_watch = 1;
break;
case 'x':
do_watch = 0;
break;
default:
fprintf (stderr, "%s [-d|-a|-p|-P|-b N|-f|-i|-e|-.|-/|-l|-m N|-r N|-s|-S|-u|-w|-x]\n", argv[0]);
fprintf (stderr, " -d reset values to defaults\n"
" -a full AmigaDOS mode, no ./ translations\n"
" -p use case-insensitive filename pattern-matching\n"
" -P use case-sensitive filename pattern-matching\n"
" -b N N physical block map into 1 logical (stdio) block\n"
" -f don't accept AmigaDOS notation\n"
" -i ignore global environment (ENV:)\n"
" -e don't ignore global environment (ENV:)\n"
" -. translate . and ..\n"
" -/ translate /foo -> foo: and a//b -> a/b\n"
" -l translate contents of symbolic links\n"
" -m N files upto N bytes are cached in memory\n"
" -r N set red zone size to N bytes. 0 disables.\n"
" -s prevent flushing of the library.\n"
" -S allow flushing of the library.\n"
" -v suppress the \"Insert volume in drive\" requester\n"
" -u do not accept #? wildcards\n"
" -w enable stack watcher\n"
" -x disable stack watcher\n");
exit (1);
}
ixemulbase->ix_translate_dots = do_dots;
ixemulbase->ix_translate_slash = do_slash;
ixemulbase->ix_translate_symlinks = do_links;
ixemulbase->ix_force_translation = do_force;
ixemulbase->ix_membuf_limit = mem_buf;
ixemulbase->ix_red_zone_size = red_zone_size;
ixemulbase->ix_watch_stack = do_watch;
ixemulbase->ix_fs_buf_factor = fs_buf_factor;
ixemulbase->ix_ignore_global_env = ignore_global_env;
ixemulbase->ix_unix_pattern_matching_case_sensitive = unix_pattern_matching_case_sensitive;
ixemulbase->ix_no_insert_disk_requester = no_insert_disk_requester;
ixemulbase->ix_allow_amiga_wildcard = allow_amiga_wildcard;
printf ("%sranslate . and .., %stranslate /, %stranslate symlinks,\n"
"%sallow AmigaDOS notation, membuf size = %d,\n"
"red zone size = %d, stack watcher is %s %s,\n"
"%d physical blocks build%s one logical block (for stdio),\n"
"%signore global environment (ENV:),\n"
"use case-%ssensitive pattern-matching,\n"
"%ssuppress the \"Insert volume in drive\" requester,\n"
"%saccept #? as wildcard.\n",
do_dots ? "T" : "Don't t",
do_slash ? "" : "don't ",
do_links ? "" : "don't ",
do_force ? "don't " : "",
mem_buf,
red_zone_size,
do_watch ? "enabled" : "disabled",
red_zone_size ? (do_watch ? "(and active)" : "(and not active)")
: (do_watch ? "(but not active)" : "(and not active)"),
fs_buf_factor, fs_buf_factor == 1 ? "s" : "",
ignore_global_env ? "" : "don't ",
unix_pattern_matching_case_sensitive ? "" : "in",
no_insert_disk_requester ? "" : "do not ",
allow_amiga_wildcard ? "" : "do not ");
/* if -s is specified, the program keeps the library open until it is
interrupted. That way, the library can't be flushed, so the preferences
are not reset */
if (do_sleep)
{
if (do_sleep == 's' && !no_flushing)
{
ixemulbase->ix_do_not_flush_library = 1;
ixemulbase->ix_lib.lib_OpenCnt++;
}
if (do_sleep == 'S' && no_flushing)
{
ixemulbase->ix_do_not_flush_library = 0;
ixemulbase->ix_lib.lib_OpenCnt--;
}
}
return 0;
}